package com.leapp.sk.sever.notify

import com.example.util.ObjectProcessingUtil
import com.leapp.sk.bean.ParentClassNotifyEntity
import com.leapp.sk.bean.TeacherClassNotifyEntity
import com.leapp.sk.bean.page.notify.ParentClassNotifyPageEntity
import com.leapp.sk.bean.page.notify.TeacherClassNotifyPageEntity
import com.leapp.sk.bean.request.personal.ParentClassNotifyResponseEntity
import com.leapp.sk.bean.response.notify.TeacherClassNotifyResponseEntity
import com.leapp.sk.viewdelegate.notify.ClassNotifyDelegate
/**
 * 班级通知逻辑处理类
 * @author  chaohaipeng  on 2018/8/29.
 */
class ClassNotifySever {
    private object mHolder {
        val instance = ClassNotifySever()
    }
    companion object {
        fun getInstance(): ClassNotifySever {
            return mHolder.instance
        }
    }
    /**
     * 获取家长数据
     */
    fun getParentData(obj: ParentClassNotifyResponseEntity?, viewDelegate: ClassNotifyDelegate?):List<ParentClassNotifyEntity>?{
        val dataPage: ParentClassNotifyPageEntity = ObjectProcessingUtil.objMandatoryConversionClass(obj?.data, ParentClassNotifyPageEntity::class.java)
        val records = dataPage?.records
        viewDelegate?.setLoadPageData(dataPage?.current,dataPage?.pages,dataPage?.total)
        return records
    }
    /**
     * 获取老师数据
     */
    fun getTeacherData(obj: TeacherClassNotifyResponseEntity?, viewDelegate: ClassNotifyDelegate?):List<TeacherClassNotifyEntity>?{
        val dataPage: TeacherClassNotifyPageEntity = ObjectProcessingUtil.objMandatoryConversionClass(obj?.data, TeacherClassNotifyPageEntity::class.java)
        val records = dataPage?.records
        viewDelegate?.setLoadPageData(dataPage?.current,dataPage?.pages,dataPage?.total)
        return records
    }
}